package sandbox.j2se.statics;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

public class Base {
    
    protected static Map<Integer, String> types = new HashMap<Integer, String>();

    static {
        types.put(1, "one");
        types.put(2, "two");
    }

    public static final Collection<Integer> values() {
        return types.keySet();
    }

    public static final String getMnemo(int code) throws Exception {
        String mnemo = types.get(code);
        if(mnemo == null) {
            throw new Exception("unknown code " + code);
        }
        return mnemo;
    }

    protected Base() {
    }
}
